#ifndef PURG_SERIAL_STREAMS_H
#define PURG_SERIAL_STREAMS_H

#include "buffer.h"

#ifndef PURG_C_INTERFACE_COMPILE
namespace purg
{
#endif
  template <unsigned char BYTE=0 , unsigned int BUFFER_LENGTH=1024>
  class  single_byte_stream_tmpl
  {
    public:
      enum { buffer_length = BUFFER_LENGTH };

      typedef  char       state;
      typedef  int        seed;

      static void  initialize ( state & , buffer & , seed & , size_t );
      static void  update_buffer ( state & , buffer & );

      static void  lock ( state & ) {}
      static void  unlock ( state & ) {}
  };


  template <unsigned int MULTIPLIER , 
            unsigned int INCREMENT , 
            unsigned int MODULUS_EXP = 32 >
  class  lcg_pow_2_tmpl
  {

    public:
      enum { buffer_length = 4 };

      typedef  unsigned int      state;
      typedef  unsigned int      seed;

    private:
      static void  perform_update ( state & , state & );

    public:
      static void  initialize ( state & , buffer & , seed & , size_t );
      static void  update_buffer ( state & , buffer & );

      static void  lock ( state & ) {}
      static void  unlock ( state & ) {}
  };
#ifndef PURG_C_INTERFACE_COMPILE
}
#endif

#include "serial_streams.tmpl.h"

#endif
